import Vue from 'vue'
import App from './App.vue'
import router from './route';
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';

import {postRequest} from "./utils/api";
import {postKeyValueRequest} from "./utils/api";
import {putRequest} from "./utils/api";
import {deleteRequest} from "@/utils/api";
import {getRequest} from "./utils/api";
import Date from "@/utils/date";
import VueParticles from "vue-particles";
Vue.use(VueParticles)  

Vue.prototype.postRequest = postRequest;
Vue.prototype.postKeyValueRequest = postKeyValueRequest;
Vue.prototype.putRequest = putRequest;
Vue.prototype.deleteRequest = deleteRequest;
Vue.prototype.getRequest = getRequest;
Vue.prototype.imgDomain = 'http://localhost/file';
Vue.config.productionTip = false

Vue.use(ElementUI);



router.beforeEach((to, from, next) => {
  if (to.path == '/') {
    next();
  } else {
    // if (window.sessionStorage.getItem("user")) {
    //   next();
    // } else {
    //   next('/?redirect=' + to.path);
    // }
    next();
  }
})


new Vue({
  render: h => h(App),
  router
}).$mount('#app')
